<?php
use wodrow\yii2wtools\tools\JsBlock;
use common\assets\Layui;
use wodrow\yii2wtools\tools\Tree;
use common\Tools;
use yii\helpers\Url;
use fztadmin\modules\rbac\widgets\power_tree_list\PowerTreeList;
use common\models\db\AdminPower;
use yii\bootstrap\Html;
use yii\bootstrap\Modal;
use igorvolnyi\widgets\modal\ModalAjaxMultiple;
use yii\widgets\Pjax;

/* @var $this yii\web\View */
/* @var $user \common\models\db\User */
$this->title = "权限节点列表";
$user = Yii::$app->user->identity;
$powerTree = Tree::list2tree(AdminPower::getAllPowerArr(), null);
?>

<?php Pjax::begin(['id' => "id-pjax", 'timeout' => 3600]); ?>
<div class="admin-power-index">
    <div class="row">
        <div class="col-xs-12">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    权限树状列表
                    <?php
                    echo ModalAjaxMultiple::widget([
                        'header' => '新增根菜单',
                        'toggleButton' => [
                            'label' => '新增根菜单',
                            'class' => 'btn btn-danger pull-right btn-xs'
                        ],
                        'url' => Url::to(['/rbac/power/new']), // Ajax view with form to load
                        'ajaxSubmit' => true, // Submit the contained form as ajax, true by default
                        'options' => ['class' => 'header-primary'],
                        'autoClose' => true,
//                        'pjaxContainer' => '#id-pjax',
                    ]);
                    ?>
                </div>
                <div class="panel-body">
                    <table class="table table-bordered table-hover table-primary">
                        <thead>
                        <tr class="table-primary">
                            <th>权限名</th>
                            <th>类型</th>
                            <th>路由</th>
                            <th>排序</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody class="table-condensed ">
                        <?=PowerTreeList::widget([
                            'powerTree' => $powerTree,
                            'nst' => ''
                        ]) ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<?php Pjax::end(); ?>

<?php JsBlock::begin(); ?>
<script>

</script>
<?php JsBlock::end(); ?>
